package com.kma.summer2012.model;
// Generated Dec 6, 2012 12:14:41 AM by Hibernate Tools 3.2.1.GA


import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * CrumbsCatalogOfWork generated by hbm2java
 */
@Entity
@Table(name = "CRUMBS_CATALOG_OF_WORK"
        , schema = "KMA1"
)
public class CrumbsCatalogOfWork implements java.io.Serializable {


    private int id;
    private CrumbsCatalogOfWork crumbsCatalogOfWork;
    private String workDescription;
    private Integer runtime;
    private boolean isParent;
    private String workname;
    private Set<CrumbsCatalogOfWork> crumbsCatalogOfWorks = new HashSet<CrumbsCatalogOfWork>(0);
    private Set<CrumbsCatalogOfTools> crumbsCatalogOfToolses = new HashSet<CrumbsCatalogOfTools>(0);
    private Set<CrumbsRequestAndWork> crumbsRequestAndWorks = new HashSet<CrumbsRequestAndWork>(0);

    public CrumbsCatalogOfWork() {
    }


    public CrumbsCatalogOfWork(int id, boolean isParent, String workname) {
        this.id = id;
        this.isParent = isParent;
        this.workname = workname;
    }

    public CrumbsCatalogOfWork(int id, CrumbsCatalogOfWork crumbsCatalogOfWork, String workDescription, Integer runtime, boolean isParent, String workname, Set<CrumbsCatalogOfWork> crumbsCatalogOfWorks, Set<CrumbsCatalogOfTools> crumbsCatalogOfToolses, Set<CrumbsRequestAndWork> crumbsRequestAndWorks) {
        this.id = id;
        this.crumbsCatalogOfWork = crumbsCatalogOfWork;
        this.workDescription = workDescription;
        this.runtime = runtime;
        this.isParent = isParent;
        this.workname = workname;
        this.crumbsCatalogOfWorks = crumbsCatalogOfWorks;
        this.crumbsCatalogOfToolses = crumbsCatalogOfToolses;
        this.crumbsRequestAndWorks = crumbsRequestAndWorks;
    }

    @Id

    @Column(name = "ID", unique = true, nullable = false, precision = 9, scale = 0)
    public int getId() {
        return this.id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "PARENT_ID")
    public CrumbsCatalogOfWork getCrumbsCatalogOfWork() {
        return this.crumbsCatalogOfWork;
    }

    public void setCrumbsCatalogOfWork(CrumbsCatalogOfWork crumbsCatalogOfWork) {
        this.crumbsCatalogOfWork = crumbsCatalogOfWork;
    }

    @Column(name = "WORK_DESCRIPTION", length = 1000)
    public String getWorkDescription() {
        return this.workDescription;
    }

    public void setWorkDescription(String workDescription) {
        this.workDescription = workDescription;
    }

    @Column(name = "RUNTIME", precision = 9, scale = 0)
    public Integer getRuntime() {
        return this.runtime;
    }

    public void setRuntime(Integer runtime) {
        this.runtime = runtime;
    }

    @Column(name = "IS_PARENT", nullable = false, precision = 1, scale = 0)
    public boolean isIsParent() {
        return this.isParent;
    }

    public void setIsParent(boolean isParent) {
        this.isParent = isParent;
    }

    @Column(name = "WORKNAME", nullable = false, length = 40)
    public String getWorkname() {
        return this.workname;
    }

    public void setWorkname(String workname) {
        this.workname = workname;
    }

    @OneToMany(cascade = {CascadeType.ALL}, fetch = FetchType.EAGER, mappedBy = "crumbsCatalogOfWork")
    public Set<CrumbsCatalogOfWork> getCrumbsCatalogOfWorks() {
        return this.crumbsCatalogOfWorks;
    }

    public void setCrumbsCatalogOfWorks(Set<CrumbsCatalogOfWork> crumbsCatalogOfWorks) {
        this.crumbsCatalogOfWorks = crumbsCatalogOfWorks;
    }

    @ManyToMany(cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}, fetch = FetchType.LAZY)
    @JoinTable(name = "CRUMBS_WORK_AND_TOOLS", schema = "KMA1", joinColumns = {
            @JoinColumn(name = "WORK_ID", nullable = false, updatable = false)}, inverseJoinColumns = {
            @JoinColumn(name = "TOOL_ID", nullable = false, updatable = false)})
    public Set<CrumbsCatalogOfTools> getCrumbsCatalogOfToolses() {
        return this.crumbsCatalogOfToolses;
    }

    public void setCrumbsCatalogOfToolses(Set<CrumbsCatalogOfTools> crumbsCatalogOfToolses) {
        this.crumbsCatalogOfToolses = crumbsCatalogOfToolses;
    }

    @OneToMany(cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}, fetch = FetchType.LAZY, mappedBy = "crumbsCatalogOfWork")
    public Set<CrumbsRequestAndWork> getCrumbsRequestAndWorks() {
        return this.crumbsRequestAndWorks;
    }

    public void setCrumbsRequestAndWorks(Set<CrumbsRequestAndWork> crumbsRequestAndWorks) {
        this.crumbsRequestAndWorks = crumbsRequestAndWorks;
    }


}


